/*
* Copyright (c) 2010 Michael Collins
*
* This file is part of TerraFirma.
*
* TerraFirma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TerraFirma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TerraFirma.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PHYSICS_ENTITY_H
#define PHYSICS_ENTITY_H

#include <entity.h>

namespace game
{


    class Physics_Entity : public Entity
    {
    public:
        Physics_Entity();
        Physics_Entity(const fixedpoint::vec2d& p, const fixedpoint::vec2d& d, const char* n);
        virtual ~Physics_Entity();

        //Simple runtime type-checking mechanics
        virtual bool is_physics_ent() const {return true;}
        virtual bool is_vehicle_ent() const {return false;}
        virtual bool is_weapon_ent() const {return false;}
        virtual bool is_hud_ent() const {return false;}
        virtual uint32_t type() const {return PHYSICS;}

        fixedpoint::vec2d velocity;
        fixedpoint::fixpoint angular_vel, mass;

        //These members are modified during operation, and that's how the simulation knows how to handle the object
        fixedpoint::vec2d force; //consistent force on the center of mass
        fixedpoint::fixpoint torque; //consistent torque about the center (caused by a force offset from the center)
        fixedpoint::vec2d impulse; //Instantaneous unit of force for this specific time tick
        fixedpoint::fixpoint moment_impulse; //instantaneous unit of torque for this specific time tick

        //Hull defines the shape of this entity
        //HULL NOT IMPLEMENTED YET
        //const physics_hull* hull;

        //Axis-Aligned Bounding Box (dimensions)
        //qualifies a rectangular region guaranteed to wholly contain this object
        //(for determining viewability and collisions)
        fixedpoint::vec2d AABB;
        bool asleep; //When asleep, the physics simulation does not process this entity
    protected:
    private:
    };

}

#endif // PHYSICS_ENTITY_H
